43_dsPIC30 SPI Attempt
After getting PWM and digital I/O working on the dsPIC30. I needed to start trying to get the SPI module working so that our PIC could communicate with the ADC. Following online resources and the dsPIC30f4012 data sheet, I built a SPI_init() function (Figure 1), a SPI_read() function (Figure 2), and a SPI_write() function (Figure 3).
Figure 1: dsPIC30 SPI_init() Function
Figure 2: dsPIC30 SPI_read() Function
Figure 3: sPIC30 SPI_write() Function
Monitoring the SCK and SDO pins with an oscilloscope, I wasn’t able to detect any clock signals or anything from the SPI system. I decided not to spend too much more time trying to get the dsPIC30’s SPI system working since the dsPIC33 would be a bit different, probably with its own problems. Most of the SPI registers are very similar between the dsPIC30 and dsPIC33 though.